package com.itheima.user.controller;

import com.itheima.common.vo.ResultVo;
import com.itheima.user.dto.LoginDto;
import com.itheima.user.pojo.ApUser;
import com.itheima.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private ApUserService apUserService;

    @PostMapping("/login_auth")
    public ResultVo<ApUser> login(@RequestBody LoginDto dto){
       Map<String,Object> apUser = apUserService.login(dto);
       return ResultVo.ok(apUser);
    }
}
